<?php

/**
 * Created by PhpStorm.
 * User: LinFei
 * Created time 2022/12/16 16:53:02
 * E-mail: fly@eyabc.cn
 */
declare (strict_types=1);

namespace Newbie\Annotation\Parser;

use Newbie\Annotation\Attributes\Bean;
use Newbie\Annotation\Contracts\IAnnotationParser;


class ContainerAnnotationParser implements IAnnotationParser {
    public static function process (array $item): void {
        if ($item['annotation'] == Bean::class) {
            self::definition($item);
        }
    }

    public static function definition (array $item): void {
        $params = $item['parameters'];

        if ($params['name']) {
            container()->set($params['name'], $item['class']);
        }
    }
}
